package com.dcc.inventory.controller;

import com.dcc.inventory.entity.Room;
import com.dcc.inventory.servicesimp.RoomServicesImp;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/api/room")
public class RoomController {
     @Resource
    RoomServicesImp roomServicesImp;

    @RequestMapping(value = "/searchRoomAll", method = RequestMethod.GET)
    @ResponseBody
    public Map<String ,Object> searchRoomAll(){
       Map map = new HashMap();
        List<Room> list = roomServicesImp.searchRoomAll();
        if (list.size() >0){
            map.put("data",list);
        }
        return map;
    }
}
